{% extends "security/panel.html" %}
{% block panel_image %}
<div class="pr-4">
 <img src="{{ url_for('static', filename='img/login.svg') }}" alt="{{ _('Login') }}">
</div>
{% endblock %}
{% block panel_title %}{{ _('Login') }}{% endblock %}
{% block panel_body %}
{% if config.SERVER_MODE %}
<form action="{{ url_for('authenticate.login') }}" method="POST" name="login_user_form">
    {{ login_user_form.hidden_tag() }}
    {% set user_language = request.cookies.get('PGADMIN_LANGUAGE') or 'en' %}
    {{ render_username_with_errors(login_user_form.email, "text") }}
    {{ render_field_with_errors(login_user_form.password, "password") }}
    <button name="internal_button" {% if (config.OAUTH2 in config.AUTHENTICATION_SOURCES or config.KERBEROS in config.AUTHENTICATION_SOURCES) and config.AUTHENTICATION_SOURCES | length == 1 %} disabled {% endif %} class="btn btn-primary btn-block btn-login" type="submit" value="{{ _('Login') }}">{{ _('Login') }}</button>
    <div class="form-group row mb-3 c user-language">
        <div class="col-7"><span class="help-block">{{ _('<a href="%(url)s" class="text-white">Forgotten your password</a>?', url=url_for('browser.forgot_password')) }}</span></div>
        <div class="col-5">
            <select class="form-control" name="language" value="{{user_language}}">
                {% for key, lang in config.LANGUAGES.items() %}
                <option value="{{key}}" {% if user_language == key %}selected{% endif %}>{{lang}}</option>
                {% endfor %}
            </select>
        </div>
    </div>
{% if config.OAUTH2 in config.AUTHENTICATION_SOURCES and config.AUTHENTICATION_SOURCES %}
    {% for oauth_config in config.OAUTH2_CONFIG %}
        <button name="oauth2_button" class="btn btn-primary btn-block btn-oauth" style="background-color: {{oauth_config['OAUTH2_BUTTON_COLOR']}}" value="{{ oauth_config['OAUTH2_NAME'] }}" type="submit">
            <i class="fab {{ oauth_config['OAUTH2_ICON'] }} fa-lg mr-2" aria-hidden="true" role="image"></i>
            {{ _('Login with %(oauth_name)s', oauth_name=oauth_config['OAUTH2_DISPLAY_NAME']) }}</button>
    {% endfor %}
{% endif %}
</form>
{% endif %}
{% endblock %}
